﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using WebServer.Models;

namespace WebServer
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码和配置文件中的接口名“INews”。
    [ServiceContract]
    public interface INews
    {
        #region 分类逻辑
          /// <summary>
        /// 获取所有的子分类 
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        [OperationContract]
        List<NewsCate> ManCate(bool IsDel);

        /// <summary>
        /// 获取分类
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        [OperationContract]
        List<NewsCate> Cate(int ID, bool IsDel);


        /// <summary>
        /// 获取单个分类
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        [OperationContract]
        NewsCate CateByID(int ID);


        /// <summary>
        /// 创建分类
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="ParentID"></param>
        /// <returns></returns>
        [OperationContract]
        bool CateCreate(string Name, int ParentID);

        /// <summary>
        /// 更新分类-Name为空，Parent为-1则更新IsDel，否则更新 Name和 Parent（2个必须都传）
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        [OperationContract]
        bool CateSet(int ID,string Name,int Parent, bool IsDel);

          /// <summary>
        /// 新闻动作
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="Fild"></param>
        /// <param name="Fn"></param>
        /// <returns></returns>
        [OperationContract]
        int CateAction(int ID, string Fild, bool Fn);


          /// <summary>
        /// 获取判断是否有子节点的分类
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        [OperationContract]
        List<NewsCate> CateList(int ID, bool IsDel);
        #endregion


        #region 资讯处理
          /// <summary>
        /// 后台获取新闻
        /// </summary>
        /// <param name="CateID"></param>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="Title"></param>
        /// <param name="BourseName"></param>
        /// <param name="IsStick">0-不置顶，1-置顶，-1代表全部</param>
        /// <param name="IsHeadline">0-不是头条，1-是头条，-1代表全部</param>
        /// <param name="HasImg"></param>
        /// <param name="Order">默认为创建时间，1-标题，2-点击率3-交易所，4-回复数</param>
        /// <param name="Desc"></param>
        /// <param name="IsDel">0-未删除，1-已删除，-1代表全部</param>
        /// <returns></returns>
        [OperationContract]
        List<News> MNewsList(int CateID, int PageSize, int PageIndex, string Title, string BourseName, int IsStick, int IsHeadline, bool HasImg, int Order, bool Desc, int IsDel);



        /// <summary>
        /// 获取存在交易所
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        List<NewsBourseGroupEntity> BourseGroup();


          /// <summary>
        /// 获取存在交易所【有centerID】
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        List<NewsBourseGroupEntity> PBourseGroup();


        /// <summary>
        /// 根据交易所获取分类的存在分组
        /// </summary>
        /// <param name="Name"></param>
        /// <returns></returns>
        [OperationContract]
        List<NewsCate> CateGroup(int Parent, string Name);

          /// <summary>
        /// 后台获取新闻总数
        /// </summary>
        /// <param name="CateID"></param>     
        /// <param name="Title"></param>
        /// <param name="BourseName"></param>
        /// <param name="IsStick"></param>
        /// <param name="IsHeadline"></param>
        /// <param name="HasImg"></param>    
        /// <param name="IsDel"></param>
        /// <returns></returns>
        [OperationContract]
        int MNewsCount(int CateID, string Title, string BourseName, int IsStick, int IsHeadline, bool HasImg, int IsDel);

        /// <summary>
        /// 获取新闻详情
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        [OperationContract]
        News NewsByID(int ID);

        /// <summary>
        /// 新闻排行获取-0:点击量;1:ID;;2创建时间;3:更新时间 ;4:评论
        /// </summary>
        /// <param name="CateID"></param>
        /// <param name="Size"></param>
        /// <param name="Field"></param>
        /// <returns></returns>
        [OperationContract]
        List<News> NewsBySort(int CateID, bool IsHeadle, int Size, int Sort, bool Desc);
        
        /// <summary>
        /// 根据CenterID获取新闻
        /// </summary>
        /// <param name="CateID"></param>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="Title"></param>
        /// <param name="CenterID"></param>
        /// <param name="IsStick"></param>
        /// <param name="IsHeadline"></param>
        /// <param name="HasImg"></param>
        /// <param name="Order">默认为创建时间，1-标题，2-点击率3-交易所，4-回复数</param>
        /// <param name="Desc"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        [OperationContract]
        List<News> NewsListByCenterID(int CateID, int PageSize, int PageIndex, string Title, int CenterID, int IsStick, int IsHeadline, bool HasImg, int Order, bool Desc, int IsDel);

        /// <summary>
        /// 新闻列表
        /// </summary>
        /// <param name="CateID"></param>
        /// <param name="Page"></param>
        /// <param name="PageSize"></param>
        /// <param name="BourseName"></param>
        /// <param name="IsHEadLine"></param>
        /// <param name="HasImg"></param>
        /// <returns></returns>
        [OperationContract]
        List<News> NewsList(int CateID, int Page, int PageSize, string BourseName, bool IsStick, bool IsHeadline, bool HasImg, bool IsDel);

            /// <summary>
        /// 获取没有解读的新闻
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        [OperationContract]
        List<News> NoReadingNewsList(int CateID, int Page, int PageSize, string BourseName, bool IsStick, bool IsHeadline, bool HasImg, bool IsDel);

        /// <summary>
        /// 新闻动作- Filed == "IsHeadline" || Filed == "Stick" || Filed == "Commend" || Filed == "IsDel"
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        [OperationContract]
        bool NewsAction(int ID, string Filed, bool Fn);


        /// <summary>
        /// 新增以及更新新闻
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        [OperationContract]
        bool NewsSet(News N);




        /// <summary>
        /// 新增以及更新新闻
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        [OperationContract]
        int NewsInfoSet(News N);

        /// <summary>
        /// 获取新闻详情
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        [OperationContract]
        News NewsInfoByID(int ID);


        /// <summary>
        /// 获取上一篇，下一篇
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        [OperationContract]
        List<NewsKeys> NewsCon(int ID);
        #endregion


        #region 标签
        /// <summary>
        /// 获取标签
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        [OperationContract]
        List<NewsKeys> NewsLabel(int PageSize, int PageIndex, int ID, string Name, bool IsDel);

        /// <summary>
        /// 标签总数
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="Name"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        [OperationContract]
        int NewsLabelCount(int ID, string Name, bool IsDel);

          /// <summary>
        /// 根据ID获取标签
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        [OperationContract]
        NewsKeys NewsLabelByID(int ID);


        
        /// <summary>
        /// 添加或者修改标签
        /// </summary>
        /// <param name="N"></param>
        /// <returns></returns>
        [OperationContract]
        MsgEntity NewsLabelSet(NewsKeys N);

        /// <summary>
        /// 删除标签
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="Del">真删，还是假删</param>
        /// <returns></returns>
        [OperationContract]
        int NewsLabelDel(int ID, bool Del);

        
        /// <summary>
        /// 新闻关联标签
        /// </summary>
        /// <param name="N"></param>
        /// <returns></returns>
        [OperationContract]
        int NewsConKeySet(NewsConKeys N);

        #endregion

        #region 首页/咨询幻灯片
        /// <summary>
        /// 幻灯片
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        List<Slide> getImg(int IsOpen, int AppOrWeb);

         /// <summary>
        /// 后台查询所有幻灯片
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        List<Slide> getMImg(int IsOpen, int AppOrWeb, int Order, bool Desc);


        /// <summary>
        /// 删除幻灯片
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        [OperationContract]
        int DelImg(int ID);

        /// <summary>
        /// 新增或者修改幻灯片
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [OperationContract]
        int AddOrUpImg(Slide model);


          /// <summary>
        /// 根据ID获取幻灯片
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        [OperationContract]
        Slide ImgByID(int ID);
        #endregion


        #region 解读
        /// <summary>
        /// 后台获取新闻
        /// </summary>
        /// <param name="CateID"></param>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="Title"></param>
        /// <param name="BourseName"></param>
        /// <param name="IsStick"></param>
        /// <param name="IsHeadline"></param>
        /// <param name="HasImg"></param>
        /// <param name="Order">默认为创建时间，1-标题，2-点击率3-交易所，4-回复数</param>
        /// <param name="Desc"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        [OperationContract]
        List<News> ReadingList(int CateID, int PageSize, int PageIndex, string Title, string BourseName, int IsStick, int IsHeadline, bool HasImg, int Order, bool Desc, int IsDel, int UserID);

         /// <summary>
        /// 手机查询解读
        /// </summary>
        /// <param name="CateID"></param>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="Title"></param>
        /// <param name="BourseName"></param>
        /// <param name="IsStick"></param>
        /// <param name="IsHeadline"></param>
        /// <param name="HasImg"></param>
        /// <param name="Order">默认为创建时间，1-标题，2-点击率3-交易所，4-回复数</param>
        /// <param name="Desc"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        [OperationContract]
        List<News> PReadingList(int CateID, int PageSize, string OpenTime, string EndTime, string Title, string BourseName, int IsStick, int IsHeadline, bool HasImg, int Order, bool Desc, int IsDel, int UserID);

        /// <summary>
        /// 总数
        /// </summary>
        /// <param name="CateID"></param>
        /// <param name="Title"></param>
        /// <param name="BourseName"></param>
        /// <param name="IsStick"></param>
        /// <param name="IsHeadline"></param>
        /// <param name="HasImg"></param>
        /// <param name="IsDel"></param>
        /// <param name="UserID"></param>
        /// <returns></returns>
        [OperationContract]
        int ReadingCount(int CateID, string Title, string BourseName, int IsStick, int IsHeadline, bool HasImg, int IsDel, int UserID);

        /// <summary>
        /// 经济商发表解读
        /// </summary>
        /// <param name="N"></param>
        /// <returns></returns>
        [OperationContract]
        bool ReadingSet(News N);

         /// <summary>
        /// 解读删除
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        [OperationContract]
        MsgEntity ReadingDel(int ID, int UserID);


        /// <summary>
        /// 解读删除
        /// </summary>
        /// <param name="U"></param>
        /// <returns></returns>
        [OperationContract]
        int DelReading(int ID, string Admin);
        #endregion


        #region 手机资讯
        /// <summary>
        /// 后台获取新闻
        /// </summary>
        /// <param name="CateID"></param>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="Title"></param>
        /// <param name="BourseName"></param>
        /// <param name="IsStick"></param>
        /// <param name="IsHeadline"></param>
        /// <param name="HasImg"></param>
        /// <param name="Order">默认为创建时间，1-标题，2-点击率3-交易所，4-回复数</param>
        /// <param name="Desc"></param>
        /// <param name="IsDel"></param>
        /// <returns></returns>
        [OperationContract]
        List<News> PNewsList(string OpenTime, string EndTime, int PageSize, int CateID, string Title, string Name, int IsStick, int IsHeadline, bool HasImg, int Order, bool Desc, int IsDel);
        #endregion

    }
}
